home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / MacPNG Library 1.02 / pngMacSrc 1.02 / PNG Library 0.80 / PNGCONF.H < prev    next >
Text File  |  1996-05-29  |  8KB  |  217 lines

  1.  
  2. /* pngconf.c - machine configurable file for libpng
  3.  
  4.    libpng 1.0 beta 2 - version 0.8
  5.    For conditions of distribution and use, see copyright notice in png.h
  6.    Copyright (c) 1995 Guy Eric Schalnat, Group 42, Inc.
  7.    August 20, 1995
  8.    */
  9.  
  10. /* Any machine specific code is near the front of this file, so if you
  11.    are configuring libpng for a machine, you may want to read the section
  12.    starting here down to where it starts to typedef png_color, png_text,
  13.    and png_info */
  14.  
  15. #ifndef PNGCONF_H
  16. #define PNGCONF_H
  17.  
  18. /* this is the size of the compression buffer, and thus the size of
  19.    an IDAT chunk.  Make this whatever size you feel is best for your
  20.    machine.  One of these will be allocated per png_struct.  When this
  21.    is full, it writes the data to the disk, and does some other
  22.    calculations.  Making this an extreamly small size will slow
  23.    the library down, but you may want to experiment to determine
  24.    where it becomes significant, if you are concerned with memory
  25.    usage.  Note that zlib allocates at least 32Kb also.  For readers,
  26.    this describes the size of the buffer available to read the data in.
  27.    Unless this gets smaller then the size of a row (compressed),
  28.    it should not make much difference how big this is.  */
  29.  
  30. #define PNG_ZBUF_SIZE 8192
  31.  
  32. /* While libpng currently uses zlib for it's compression, it has been designed
  33.    to stand on it's own.  Towards this end, there are two defines that are
  34.    used to help portability between machines.  To make it simpler to
  35.    setup libpng on a machine, this currently uses zlib's definitions, so
  36.    any changes should be made in zlib.  Libpng will check zlib's settings
  37.    and adjust it's own accordingly. */
  38.  
  39. /* if you are running on a machine where you cannot allocate more then
  40.    64K of memory, uncomment this.  While libpng will not normally need
  41.    that much memory in a chunk (unless you load up a very large file),
  42.    zlib needs to know how big of a chunk it can use, and libpng thus
  43.    makes sure to check any memory allocation to verify it will fit
  44.    into memory.
  45. #define PNG_MAX_ALLOC_64K
  46. */
  47. #ifdef MAXSEG_64K
  48. #define PNG_MAX_ALLOC_64K
  49. #endif
  50.  
  51. /* this macro protects us against machines that don't have function
  52.    prototypes.  If your compiler does not handle function prototypes,
  53.    define this macro.  I've always been able to use _NO_PROTO as the
  54.    indicator, but you may need to drag the empty declaration out in
  55.    front of here, or change the ifdef to suit your own needs. */
  56. #ifndef PNGARG
  57.  
  58. #ifdef OF
  59. #define PNGARG(arglist) OF(arglist)
  60. #else
  61.  
  62. #ifdef _NO_PROTO
  63. #define PNGARG(arglist)
  64. #else
  65. #define PNGARG(arglist) arglist
  66. #endif /* _NO_PROTO */
  67.  
  68. #endif /* OF */
  69.  
  70. #endif /* PNGARG */
  71.  
  72. /* enough people need this for various reasons to include it here */
  73. #ifndef MACOS
  74. #include <sys/types.h>
  75. #endif
  76. /* need the time information for reading tIME chunks */
  77. #include <time.h>
  78.  
  79. /* for FILE.  If you are not using standard io, you don't need this */
  80. #include <stdio.h>
  81.  
  82. /* include setjmp.h for error handling */
  83. #include <setjmp.h>
  84.  
  85. #ifdef BSD
  86. #include <strings.h>
  87. #else
  88. #include <string.h>
  89. #endif
  90.  
  91. /* other defines for things like memory and the like can go here.  These
  92.    are the only files included in libpng, so if you need to change them,
  93.    change them here.  They are only included if PNG_INTERNAL is defined. */
  94. #ifdef PNG_INTERNAL
  95. #include <stdlib.h>
  96. #include <ctype.h>
  97. #include <math.h>
  98.  
  99. /* other defines specific to compilers can go here.  Try to keep
  100.    them inside an appropriate ifdef/endif pair for portability */
  101.  
  102. /* for some reason, Borland C++ defines memcmp, etc. in mem.h, not
  103.    stdlib.h like it should (I think).  Or perhaps this is a C++
  104.    feature */
  105. #ifdef __TURBOC__
  106. #include <mem.h>
  107. #include "alloc.h"
  108. #endif
  109.  
  110. #ifdef _MSC_VER
  111. #include <malloc.h>
  112. #endif
  113.  
  114. /* this controls how fine the dithering gets.  As this allocates
  115.    a largish chunk of memory (32K), those who are not as concerned
  116.    with dithering quality can decrease some or all of these */
  117. #define PNG_DITHER_RED_BITS 5
  118. #define PNG_DITHER_GREEN_BITS 5
  119. #define PNG_DITHER_BLUE_BITS 5
  120.  
  121. /* this controls how fine the gamma correction becomes when you
  122.    are only interested in 8 bits anyway.  Increasing this value
  123.    results in more memory being used, and more pow() functions
  124.    being called to fill in the gamma tables.  Don't get this
  125.    value less then 8, and even that may not work (I haven't tested
  126.    it). */
  127.  
  128. #define PNG_MAX_GAMMA_8 11
  129.  
  130. #endif /* PNG_INTERNAL */
  131.  
  132. /* The following defines give you the ability to remove code
  133.    from the library that you will not be using.  I wish I
  134.    could figure out how to automate this, but I can't do
  135.    that without making it seriously hard on the users.  So
  136.    if you are not using an ability, change the #define to
  137.    and #undef, and that part of the library will not be
  138.    compiled.  If your linker can't find a function, you
  139.    may want to make sure the ability is defined here.
  140.    Some of these depend upon some others being defined.
  141.    I haven't figured out all the interactions here, so
  142.    you may have to experiment awhile to get everything
  143.    to compile.
  144.    */
  145.  
  146. /* Any transformations you will not be using can be undef'ed here */
  147.  
  148. #define PNG_READ_INTERLACING_SUPPORTED
  149. #define PNG_READ_EXPAND_SUPPORTED
  150. #define PNG_READ_SHIFT_SUPPORTED
  151. #define PNG_READ_PACK_SUPPORTED
  152. #define PNG_READ_BGR_SUPPORTED
  153. #define PNG_READ_SWAP_SUPPORTED
  154. #define PNG_READ_INVERT_SUPPORTED
  155. #define PNG_READ_DITHER_SUPPORTED
  156. #define PNG_READ_BACKGROUND_SUPPORTED
  157. #define PNG_READ_16_TO_8_SUPPORTED
  158. #define PNG_READ_FILLER_SUPPORTED
  159. #define PNG_READ_GAMMA_SUPPORTED
  160. #define PNG_READ_GRAY_TO_RGB_SUPPORTED
  161.  
  162. #define PNG_WRITE_INTERLACING_SUPPORTED
  163. #define PNG_WRITE_SHIFT_SUPPORTED
  164. #define PNG_WRITE_PACK_SUPPORTED
  165. #define PNG_WRITE_BGR_SUPPORTED
  166. #define PNG_WRITE_SWAP_SUPPORTED
  167. #define PNG_WRITE_INVERT_SUPPORTED
  168. #define PNG_WRITE_FILLER_SUPPORTED
  169.  
  170. /* any chunks you are not interested in, you can undef here.  The
  171.    ones that allocate memory may be expecially important (hIST,
  172.    tEXt, zTXt, tRNS) Others will just save time and make png_info
  173.    smaller.  OPT_PLTE only disables the optional palette in RGB
  174.    and RGB Alpha images. */
  175.  
  176. #define PNG_READ_gAMA_SUPPORTED
  177. #define PNG_READ_sBIT_SUPPORTED
  178. #define PNG_READ_cHRM_SUPPORTED
  179. #define PNG_READ_tRNS_SUPPORTED
  180. #define PNG_READ_bKGD_SUPPORTED
  181. #define PNG_READ_hIST_SUPPORTED
  182. #define PNG_READ_pHYs_SUPPORTED
  183. #define PNG_READ_oFFs_SUPPORTED
  184. #define PNG_READ_tIME_SUPPORTED
  185. #define PNG_READ_tEXt_SUPPORTED
  186. #define PNG_READ_zTXt_SUPPORTED
  187. #define PNG_READ_OPT_PLTE_SUPPORTED
  188.  
  189. #define PNG_WRITE_gAMA_SUPPORTED
  190. #define PNG_WRITE_sBIT_SUPPORTED
  191. #define PNG_WRITE_cHRM_SUPPORTED
  192. #define PNG_WRITE_tRNS_SUPPORTED
  193. #define PNG_WRITE_bKGD_SUPPORTED
  194. #define PNG_WRITE_hIST_SUPPORTED
  195. #define PNG_WRITE_pHYs_SUPPORTED
  196. #define PNG_WRITE_oFFs_SUPPORTED
  197. #define PNG_WRITE_tIME_SUPPORTED
  198. #define PNG_WRITE_tEXt_SUPPORTED
  199. #define PNG_WRITE_zTXt_SUPPORTED
  200.  
  201. /* some typedefs to get us started.  These should be safe on most of the
  202.    common platforms.  The typedefs should be at least as large
  203.    as the numbers suggest (a png_uint_32 must be at least 32 bits long),
  204.    but they don't have to be exactly that size. */
  205.  
  206. typedef unsigned long png_uint_32;
  207. typedef long png_int_32;
  208. typedef unsigned short png_uint_16;
  209. typedef short png_int_16;
  210. typedef unsigned char png_byte;
  211.  
  212. /* this is usually size_t. it is typedef'ed just in case you need it to
  213.    change (I'm not sure if you will or not, so I thought I'd be safe) */
  214. typedef size_t png_size_t;
  215.  
  216. #endif /* PNGCONF_H */
  217.